<?php
/**
 * Created by PhpStorm.
 * User: DL
 * Date: 2018/8/27
 * Time: 10:42
 */

include($_SERVER['DOCUMENT_ROOT']."/system/inc/config.php");
include($_SERVER['DOCUMENT_ROOT']."/system/inc/db.php");
if(empty($_REQUEST['lang_id'])){
    echo '非法请求!';exit;
}
$lang_id=$_REQUEST['lang_id'];
// $dataCount=0;
// $pageSize=10;
// $pageNo=1;
// if(!empty($_REQUEST['pageNo'])){
//     $pageNo=$_REQUEST['pageNo'];
// }
// $where=" order by id desc limit ".($pageNo-1)*$pageSize.",".$pageSize;
// $pageNum=0;
$sql="select * from oc_company_setup ";
// $sqlCount="select count(`id`) from oc_company_setup where client_id=$id";
// $sqlCount.=$where;
mysql_query('set names utf8');
// $result=mysql_query($sqlCount);
// while ($row=mysql_fetch_row($result)){
//     $dataCount=$row[0];
// }
// $pageNum=ceil($dataCount/$pageSize); 
// $sql.=$where;
//1 中文 2英文
$data['data']=array();
$result=mysql_query($sql);
if($lang_id == '1'){
    $i=0;
    while ($assoc=mysql_fetch_assoc($result)){
        $id=$assoc['home_id'];
        $data['data'][$i]['id']=$id;
        if($lang_id == '1'){
            $data['data'][$i]['title_cn']=$assoc['title_cn'];
            $data['data'][$i]['details_cn']=$assoc['details_cn'];
        }else if($lang_id == '2'){
            $data['data'][$i]['title_en']=$assoc['title_en'];
            $data['data'][$i]['details_en']=$assoc['details_en'];
        }

        $i++;
    }
}else if($lang_id == '2'){
    $i=0;
    while ($assoc=mysql_fetch_assoc($result)){
        $id=$assoc['home_id'];
        $data['data'][$i]['id']=$id;
        // $data['data'][$i]['title_cn']=$assoc['title_cn'];
        $data['data'][$i]['title_en']=$assoc['title_en'];
        // $data['data'][$i]['details_cn']=$assoc['details_cn'];
        $data['data'][$i]['details_en']=$assoc['details_en'];

        $i++;
    }    
}

echo json_encode($data);exit;